home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / cbm / 4785 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.9 KB  |  87 lines

  1. Path: news.iastate.edu!deaven
  2. From: deaven@ishmael.ameslab.gov (David Deaven)
  3. Newsgroups: comp.sys.cbm,gnu.gcc.help,de.comp.gnu,comp.sys.atari.8bit
  4. Subject: Re: GNU C-compiler port to 6502
  5. Date: 29 Mar 1996 23:20:47 GMT
  6. Organization: Ames Laboratory, Ames, Iowa
  7. Message-ID: <4jhr8f$hum@news.iastate.edu>
  8. References: <gnusenet199603252155.NAA11650@netcom9.netcom.com> <4je9c0$idd@esel.cosy.sbg.ac.at>
  9. NNTP-Posting-Host: ishmael.ameslab.gov
  10.  
  11. In article <4je9c0$idd@esel.cosy.sbg.ac.at>,
  12. Gerhard Wesp <gwesp@cosy.sbg.ac.at> wrote:
  13. >Here goes the complete example:
  14. >Let test.c be:
  15. >
  16. >char *p;
  17. >foo()
  18. >{
  19. >  while(*p);
  20. >}
  21. >
  22.  
  23.   Just for completeness, here's what you get if you use CC65 (the Atari C
  24. compiler) on this example code:
  25. ------------------
  26. _p:
  27.     .blkb    2
  28. _foo:
  29.     jsr    enterfun
  30. L2:
  31.     lda    _p
  32.     ldx    _p+1
  33.     jsr    ldai
  34.     jsr    tstax
  35.     lbeq    L3
  36.     jmp    L2
  37. L3:
  38.     jmp    exitfun
  39.     .globl    _foo
  40.     .globl    _p
  41. ------------------
  42.  
  43.   Note the two subroutine calls required for each bit test.  This might be
  44. the lesser of two evils in a 6502 C compiler.  Gerhard had reported on
  45. the results using the "Oric" compiler (I never heard of that one
  46. before) which has other problems:
  47.  
  48. >_foo
  49. >Ltest1
  50. >Ltest2
  51. >        ldx _p
  52. >        lda _p+1
  53. >        stx tmp
  54. >        sta tmp+1
  55. >        ldy #0
  56. >        lda (tmp),y
  57. >        sta tmp0
  58. >
  59. >        lda #0
  60. >        ldx tmp0
  61. >        stx tmp0
  62. >        bpl *+4
  63. >        lda #$FF
  64. >        sta tmp0+1
  65. >
  66. >        lda tmp0
  67. >        ora tmp0+1
  68. >        beq *+5
  69. >        jmp Ltest1
  70. >
  71. >        rts
  72. >
  73. >_p
  74. >        RESERVE 2
  75. >
  76. >Note that this is the ORIC C-compiler found at 
  77. >http://www.dcs.ed.ac.uk/~axc/FLOOR1/oric.html#compiler
  78. >(this is derived from lcc) and _not_ the ATARI cc65 from umich.edu. 
  79. >(Just the executable names coincide).
  80.  
  81. -- 
  82. David Deaven        deaven@ishmael.ameslab.gov
  83. A504 Physics        tel 515-294-6878
  84. Ames Laboratory     fax 515-294-0689
  85. Ames IA 50011       http://www.public.iastate.edu/~deaven
  86.